package {
	import abio.XasML.builder.context;
	import abio.XasML.global;
	import abio.XasML.rpc.classLoader;
	import abio.XasML.rpc.command;
	import abio.XasML.rpc.commandChain;
	import abio.XasML.rpc.connectionService;
	import abio.XasML.rpc.staticLoader;
	import abio.file.component.ttt;
	
	import flash.display.Sprite;
	
	import mx.binding.utils.BindingUtils;
	import mx.rpc.events.ResultEvent;

	public class file extends Sprite
	{
		[Bindable]
		public var bind_1:String="";		
		[Bindable]
		public var bind_2:String="";
		
		public function file()
		{
/*			var cc:commandChain=new commandChain(commandChain.SERIES);
			cc.add(new command(new connectionService('http://localhost/file/amf/').echo,function a1(re:ResultEvent):void{
				trace('cs1', re.result);
			}),'asd');
			cc.add(new command(new connectionService('http://localhost/file/amf/').echo2,function a2(re:ResultEvent):void{
				trace('cs2', re.result);
			}),'zxc',1234);
			cc.add(new command(new staticLoader('http://localhost/file/swf/')['abio/file/component/text.swf'],function r1(re:ResultEvent):void{
				trace('sl1', re.result);
			}));
			cc.add(new command(new staticLoader('http://localhost/file/swf/')['abio/file/component/page.swf'],function r2(re:ResultEvent):void{
				trace('sl2', re.result);
			}));
			cc.proceed(function rrc():void{
				trace('crc');
			});
			
			BindingUtils.bindProperty( this, "bind_1" , this, "bind_2" );
			trace(bind_1, ':', bind_2);
			bind_2='asdasda'
			trace(bind_1, ':', bind_2);

			var cl:classLoader=new classLoader('http://localhost/file/swf/abio/file/component/text.swf');
			var cmd:command=new command(cl['abio.file.component.ttt'], function RESULT1(re:ResultEvent):void{
				trace('cl_1', re.result);
				
				var cl2:classLoader=new classLoader('http://localhost/file/swf/abio/file/component/text.swf');
				var cmd2:command=new command(cl2['abio.file.component.ttt'], function RESULT2(re2:ResultEvent):void{
					trace('cl_2', re2.result);

				});
				cmd2.execute('dsa');
			});
			cmd.execute('asd');
*/			
			var cntxt1:context=global.objectBuilder(config1);
			config2.asd.id='tt';
			config2.asd.args=['321'];
			var cntxt2:context=global.objectBuilder(config2, cntxt1);
			
			trace(cntxt1.newInstance('tt','123'));
			trace(cntxt2.newInstance('asd'));
			trace(cntxt2.newInstance('tt','123'));
			trace(cntxt1.newInstance(ttt,'asd'));
			trace(cntxt2.newInstance(cfg));
			
		}
	}
}

import abio.file.component.ttt;

var config1:Object={
	'tt': ttt
};

var config2:Object={
	'asd': cfg
};
